﻿using Core.GameTool.DnPlayer;
using Core.GameTool.Framework.Common;
using Core.GameTool.Framework.Extensions;
using Core.GameTool.Ocr;
using Core.GameTool.OpenCV;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.Json;
using System.Threading;

namespace Core.GameTool.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Opencvsharp.MatchPicBySurf("11.png", "12.png");
            var list = DnConsole.GetDnList();
            //var imgbts = DnConsole.ScreenCap(list[0].IP_Port);
            //var ocrinfo = PaddleOcr.Ocr(imgbts);
            #region DNconsole
            //DnConsole.Lanunch(0);
            //while (true)
            //{
            //    bool result = DnConsole.IsLanunch(0);
            //    if (result)
            //    {
            //        break;
            //    }
            //    Console.WriteLine("当前模拟器未启动");
            //    Thread.Sleep(1000);
            //}

            

            //DnConsole.Touch(list[0].IP_Port, 411, 110);
            //DnConsole.Swipe(list[0].IP_Port, 411, 110, 411, 110);
            //DnConsole.InvokeApp(list[0].IP_Port, "com.netease.pm02/com.netease.ntunisdk.unisdk4UnityPlugin.AndroidPlugin");
            //System.IO.File.WriteAllBytes(@"c:\test.png", imgbts);
            #endregion

            #region Ocr

            //PaddleOcr.InitOcr();
            //while (true)
            //{
            //    var imgbts = DnConsole.ScreenCap(list[0].IP_Port);
            //    var ocrinfo = PaddleOcr.Ocr(imgbts);
            //    var json = ocrinfo.ToJson();
            //    LogText.WriteLog(json);
            //    Thread.Sleep(1000);
            //    Console.WriteLine("执行了一次");
            //}

            //Console.WriteLine(json);
            #endregion

            #region opencv
            //Opencvsharp.ShowImg("11.png");
            var center=Opencvsharp.MatchTemplate("13.png", "14.png");
            #endregion

            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}
